﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>8.2.Attribute客户端缓存</title>
    <script type="text/javascript" src="../Content/highlighter/scripts/shCore.js"></script>
    <script type="text/javascript" src="../Content/highlighter/scripts/shBrushJScript.js"></script>
    <script type="text/javascript" src="../Content/highlighter/scripts/shBrushCSharp.js"></script>
    <script type="text/javascript" src="../Content/highlighter/scripts/shBrushXml.js"></script>
    <link type="text/css" rel="stylesheet" href="../Content/highlighter/styles/shCoreDefault.css" />
    <script type="text/javascript">SyntaxHighlighter.all();</script>
</head>
<body>
    <h3>Attribute客户端缓存</h3>
    <p>
        使用缓存之前，必须先引入NFinal.Advanced;命名空间
    </p>
	<style>
	table
	{
		border-top:1px solid black;
		border-left:1px solid black;
	}
	td
	{
		border-right:1px solid black;
		border-bottom:1px solid black;
	}
	</style>
	<p>
		根据<a href="8.1.Http头Cache-Control详解.html">http头Cache-Control详解</a>中的三种情况，浏览器端缓存分为四种情况。
		<table cellspacing="0">
			<tr>
				<td>Browser对应的枚举值</td>
				<td>说明</td>
			</tr>
			
			<tr>
				<td>NoStore</td>
				<td>表示永不缓存，即第一种情况</td>
			</tr>
			<tr>
				<td>Expires</td>
				<td>一定时间内访问缓存,即第二种情况</td>
			</tr>
			<tr>
				<td>NotModify</td>
				<td>文件未修改就一直使用缓存，即第三种情况</td>
			</tr>
			
			<tr>
				<td>NoExpires</td>
				<td>表示永远缓存，一般jquery,css样式及静态文件采用此选项</td>
			</tr>
		</table>
	</p>
    <pre class="brush: csharp;">
        //urlPrefix="/App";
        namespace WebSite.App.Controllers
        {
            public class IndexController
            {
				//Server.NoCache表示服务端不缓存
				//Browser.NoStore表示浏览器缓存，缓存时间为100分钟。
				[Cache(Server.NoCache,Browser.Expires,6000)]
                public void Index()
                {
                    Write("Hello!");
                }
            }
        }
    </pre>
</body>
</html>
